﻿namespace Webinator.Performance
{
    using System;

    public class PageStatistics
    {
        public int HtmlTextRequests { get; set; }

        public int JavaScriptRequests { get; set; }

        public int CssRequests { get; set; }

        public int ImageRequests { get; set; }

        public int FlashRequests { get; set; }

        public int OthersRequests { get; set; }
        
        public int HtmlTextSize { get; set; }

        public int JavaScriptSize { get; set; }

        public int CssSize { get; set; }

        public int ImageSize { get; set; }

        public int FlashSize { get; set; }

        public int OthersSize { get; set; }

        private int RequestTotal { get { return HtmlTextRequests + JavaScriptRequests + CssRequests + ImageRequests + FlashRequests + OthersRequests; } }

        private int SizeTotal { get { return HtmlTextSize + JavaScriptSize + CssSize + ImageSize + FlashSize + OthersSize; } }

        public double HtmlTextRequestPercentage { get { return Math.Round(((Double)HtmlTextRequests / RequestTotal) * 100, 1); } }

        public double JavascriptRequestPercentage { get { return Math.Round(((Double)JavaScriptRequests / RequestTotal) * 100, 1); } }

        public double CssRequestPercentage { get { return Math.Round(((Double)CssRequests / RequestTotal) * 100, 1); } }

        public double ImageRequestPercentage { get { return Math.Round(((Double)ImageRequests / RequestTotal) * 100, 1); } }

        public double FlashRequestPercentage { get { return Math.Round(((Double)FlashRequests / RequestTotal) * 100, 1); } }

        public double OthersRequestPercentage { get { return Math.Round(((Double)OthersRequests / RequestTotal) * 100, 1); } }

        public double HtmlTextSizePercentage { get { return Math.Round(((Double)HtmlTextSize / SizeTotal) * 100, 1); } }

        public double JavascriptSizePercentage { get { return Math.Round(((Double)JavaScriptSize / SizeTotal) * 100, 1); } }

        public double CssSizePercentage { get { return Math.Round(((Double)CssSize / SizeTotal) * 100, 1); } }

        public double ImageSizePercentage { get { return Math.Round(((Double)ImageSize / SizeTotal) * 100, 1); } }

        public double FlashSizePercentage { get { return Math.Round(((Double)FlashSize / SizeTotal) * 100, 1); } }

        public double OthersSizePercentage { get { return Math.Round(((Double)OthersSize / SizeTotal) * 100, 1); } }
    }
}
